import Relay from 'react-relay';

export default class CreateTokenMutation extends Relay.Mutation {
  getMutation() {
    return Relay.QL`mutation { createToken }`;
  }

  getConfigs() {
    return [{
      type: 'REQUIRED_CHILDREN',
      children: [
        this.getFatQuery(),
      ],
    }];
  }

  getVariables() {
    return { ...this.props };
  }

  getFatQuery() {
    return Relay.QL`
        fragment on createTokenPayload {
          token
          error
          viewer{
            company{
              id
            }
          }
        }
    `;
  }
}
